const express = require("express")
const router = express.Router()

// 引入控制层
const Role = require("../controllers/roles")

// 引入中间件
const checkPermission = require('../middleware/checkPermission');
const auth = require('../middleware/auth');

router.get('/findByPk', auth, Role.findByPk)
router.post('/addrole', auth, checkPermission('role_add'), Role.create)

// 3. 角色的真删除
router.get("/del_t", auth, checkPermission('role_delete'), Role.deleterole_t)
// 4. 角色的列表
router.get("/list", auth, checkPermission('role_list'), Role.role_list_c)
// 6. 角色的修改设置数据
router.post("/edit_set", auth, checkPermission('role_edit'), Role.edit_set_c)
router.post("/pression_set", auth, checkPermission('pression_set'), Role.expression_set_c)
router.get("/pression_get", auth, checkPermission('role_list'), Role.permission_get_c)

router.get("/all", auth, checkPermission('role_list'), Role.all_role)


module.exports = router